package zzps.exeed.web.handle.argument;

import zzps.exeed.kernel.holder.ParameterHolder;
import zzps.exeed.kernel.tool.ClassTool;
import zzps.exeed.kernel.tool.StrTool;
import zzps.exeed.web.Context;
import zzps.exeed.web.annotation.RequestParam;

public class RequestParamMethodArgumentResolver implements HandlerMethodArgumentResolver{
    @Override
    public boolean support(ParameterHolder parameterHolder) {
        if (parameterHolder.hasParameterAnnotation(RequestParam.class)){
            return true;
        }
        else if(ClassTool.isSimpleType(parameterHolder.getType())){
            return true;
        }
        return false;
    }

    @Override
    public Object resolveArgument(ParameterHolder parameterHolder, Context context) {
        String name = parameterHolder.getName();
        Class<?> type = parameterHolder.getType();
        String value = context.getParameter(name);
        return null;
    }
}
